# -*- coding: utf-8 -*-

import allure
from common.page import Page
from dz_service.function.fun_service_utils import ServiceUtils
from dz_service.page_elements.el_login import login
from dz_service.page_elements.el_home import home


class Login:

    @allure.step('step:登录')
    def login(self, username, password, picture):
        Page.send_key(login, '登录页面', '用户名', username)
        Page.send_key(login, '登录页面', '密码', password)
        Page.send_key(login, '登录页面', '图片验证码', picture)
        Page.click(login, '登录页面', '登录', is_els=True, num=2)
        Page.check_page_loading(10)
        ServiceUtils.assert_element([(home, '首页', '手机号码修改', '手机号码修改', '网厅登录失败。')], log='网厅登录成功。')
